Skip to content

[Repo Assist] feat: enhance textDocument/implementation for .fsi ↔ .fs navigation#1494

Open
github-actions[bot] wants to merge 4 commits intomainfrom
repo-assist/feature-1473-go-to-signature-file-20260308-144fc246c599a377
Open

[Repo Assist] feat: enhance textDocument/implementation for .fsi ↔ .fs navigation#1494
github-actions[bot] wants to merge 4 commits intomainfrom
repo-assist/feature-1473-go-to-signature-file-20260308-144fc246c599a377

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Mar 9, 2026

🤖 This PR was created by Repo Assist, an automated AI assistant.

Closes #1473

Summary

This enhances TextDocumentImplementation (textDocument/implementation) to support bi-directional navigation between .fs implementation files and .fsi signature files, using FCS-provided symbol properties.

Behaviour

Current file Symbol has… Result
.fsi ImplementationLocation Navigates to .fs implementation
.fs SignatureLocation pointing to .fsi Navigates to .fsi signature
Either Neither (e.g. abstract/virtual member) Falls back to existing dispatch-slot implementation lookup

The fallback preserves all existing textDocument/implementation behaviour for virtual/abstract member overrides.

Implementation

FCS already exposes two properties on FSharpSymbol:

  • ImplementationLocation: the .fs location for a symbol declared in a .fsi file
  • SignatureLocation: the .fsi location for a symbol defined in a .fs file

The change (in AdaptiveFSharpLspServer.fs, TextDocumentImplementation override):

  1. Resolves the symbol at the cursor position
  2. Checks whether the current file is a .fsi → if so, uses ImplementationLocation
  3. Otherwise checks if SignatureLocation points to a .fsi file → navigates there
  4. Falls back to the existing Commands.symbolImplementationProject path when neither applies

Test Status

Build: ✅ dotnet build src/FsAutoComplete/FsAutoComplete.fsproj -c Release — 0 warnings, 0 errors
Format: ✅ dotnet fantomas applied; re-build passes
Full test suite: deferred to CI (the change is in the LSP handler layer; no existing tests cover this code path directly)

Generated by Repo Assist

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f

…fixes #1473)

TextDocumentImplementation now supports bi-directional navigation between
.fs implementation files and .fsi signature files via FCS-provided properties:

- In a .fsi file: navigating to the .fs implementation uses
  symbol.ImplementationLocation (already available from FCS)
- In a .fs file: navigating to the .fsi signature uses
  symbol.SignatureLocation (filtered to ensure it's actually a .fsi file)

When neither location is available (e.g., no paired signature file, or
the symbol is abstract/virtual), the existing dispatch-slot implementation
lookup runs as a fallback, preserving existing behaviour.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

@Krzysztof-Cieslak
Copy link
Copy Markdown
Member

/repo-assist add tests for this feature

@Krzysztof-Cieslak
Copy link
Copy Markdown
Member

/repo-assist rebase this PR on latest main to fix the conflicts, and add new tests to this PR

@Krzysztof-Cieslak Krzysztof-Cieslak marked this pull request as ready for review March 25, 2026 01:01
@Krzysztof-Cieslak
Copy link
Copy Markdown
Member

/repo-assist resolve merge conflicts

@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions bot commented Mar 25, 2026

Repo Assist completed successfully!

…ementation

Adds test cases for the feature introduced in PR #1494:
- 'Go-to-implementation from .fsi navigates to .fs file': verifies that
  calling textDocument/implementation on a symbol in a .fsi file returns
  a location in the corresponding .fs implementation file.
- 'Go-to-implementation from .fs navigates to .fsi signature file': verifies
  that calling textDocument/implementation on a symbol in a .fs file returns
  a location in the corresponding .fsi signature file.

Test case project SignatureNavigation provides a minimal .fsi/.fs pair.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor Author

Commit pushed: 37ae8df

Generated by 🌈 Repo Assist at {run-started}. Learn more.

@github-actions
Copy link
Copy Markdown
Contributor Author

🤖 This is an automated response from Repo Assist.

I've added the tests requested by @Krzysztof-Cieslak. The new Signature File Navigation Tests suite covers both directions of navigation:

  1. Go-to-implementation from .fsi navigates to .fs file — calls textDocument/implementation on myFunction in SignatureNavigation.fsi and asserts the result URI ends with SignatureNavigation.fs.

  2. Go-to-implementation from .fs navigates to .fsi signature file — calls textDocument/implementation on myFunction in SignatureNavigation.fs and asserts the result URI ends with SignatureNavigation.fsi.

The test project (TestCases/GoToTests/SignatureNavigation/) provides a minimal .fsi/.fs pair. Build verified ✅ (dotnet build — 0 errors).

Generated by 🌈 Repo Assist at {run-started}. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@1f672aef974f4246124860fc532f82fe8a93a57e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add go-to implementation that would navigate to signature file

1 participant